package ee.maoinvest.frontend.controller.command.statisticsquerycommands;

import org.apache.log4j.Logger;

import ee.maoinvest.frontend.controller.command.Command;
import ee.maoinvest.frontend.controller.command.enterpriseCommands.EnterpriseCommandFactory;

public class StatisticsQueryCommandFactory
{
private Logger logger = Logger.getLogger(EnterpriseCommandFactory.class);
	
	public Command getCommand(String triggeringEvent)
	{
		Command command = null;
		
		try 
		{
			if (triggeringEvent.equals("getHelpFindingRegularReadingIDWantedFormPostEvent"))
			{
				command = new GetHelpFindingRegularReadingIDWantedCommand();
			}
			
			if (triggeringEvent.equals("getSingleEnterpriseContractPeriodSummaryBetweenRegularReadingsGivenPage"))
			{
				command = new FillGetSingleEnterpriseStatisticsBetweenRegularReadingsGivenWithInitialDataCommand();
			}
			
			if (triggeringEvent.equals("getAllEnterprisesContractPeriodsSummariesBetweenRegularReadingsGivenPage") 
					|| triggeringEvent.equals("getAllEnterprisesEnergyConsumptionAndCostForAccountingPage"))
			{
				command = new FillGetAllEnterprisesStatisticsBetweenGivenRegularReadingsWithInitialDataCommand();
			}
			
			if (triggeringEvent.equals("getAllEnterprisesContractPeriodsSummariesWhichWereInContractWithSubstationMainElectricityMetersBetweenRegularReadingsGivenPage"))
			{
				command = new FillGetAllEnterprisesStatisticsThatAreHavingContractWithSubstationMainElectricityMeterBetweenGivenRegularReadingsWithInitialDataCommand();
			}
			
			if (triggeringEvent.equals("getSpecificParentAndItsChildMetersEnergyConsumptionStatisticsBetweenGivenRegularReadingsPage"))
			{
				command = new FillGetSpecificParentAndItsChildMetersEnergyConsumptionStatisticsBetweenGivenRegularReadingsFormConverterWithInitialDataCommand();
			}
			
			
			
			if (triggeringEvent.equals("getSingleEnterpriseStatisticsBetweenRegularReadingsGivenFormPostEvent"))
			{
				command = new GetSingleEnterpriseStatisticsBetweenRegularReadingsGivenCommand();
			}
			
			if (triggeringEvent.equals("getAllEnterprisesStatisticsBetweenGivenRegularReadingsFormPostEvent")
					|| triggeringEvent.equals("getAllEnterprisesEnergyConsumptionAndCostForAccountingFormPostEvent"))
			{
				command = new GetAllEnterprisesStatisticsBetweenGivenRegularReadingsCommand();
			}
			
			if (triggeringEvent.equals("getAllEnterprisesStatisticsThatAreHavingContractWithSubstationMainElectricityMeterBetweenGivenRegularReadingsFormPostEvent"))
			{
				command = new GetAllEnterprisesStatisticsThatAreHavingContractWithSubstationMainElectricityMeterBetweenGivenRegularReadingsCommand();
			}
			
			if (triggeringEvent.equals("getSpecificParentAndItsChildMetersEnergyConsumptionStatisticsBetweenGivenRegularReadingsFormPostEvent"))
			{
				command = new GetSpecificParentAndItsChildMetersEnergyConsumptionStatisticsBetweenGivenRegularReadingsCommand();
			}
			
		}
		catch (Exception e)
		{
			logger.warn(e.getMessage());
		}
		
		return command;
	}
}